load("@build_bazel_rules_android//android:rules.bzl", "android_library")

licenses(["notice"])

package(default_visibility = ["//visibility:public"])

android_library(
    name = "android_keystore_kms_client",
    srcs = ["AndroidKeystoreKmsClient.java"],
    deps = [
        ":android_keystore_aes_gcm",
        "//src/main/java/com/google/crypto/tink:aead-android",
        "//src/main/java/com/google/crypto/tink:kms_client-android",
        "//src/main/java/com/google/crypto/tink/subtle:random-android",
        "//src/main/java/com/google/crypto/tink/subtle:validators-android",
        "@maven//:androidx_annotation_annotation",
        "@maven//:com_google_code_findbugs_jsr305",
        "@maven//:com_google_errorprone_error_prone_annotations",
    ],
)

android_library(
    name = "android_keystore_aes_gcm",
    srcs = ["AndroidKeystoreAesGcm.java"],
    deps = ["//src/main/java/com/google/crypto/tink:aead-android"],
)

android_library(
    name = "shared_pref_keyset_writer",
    srcs = ["SharedPrefKeysetWriter.java"],
    deps = [
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:keyset_writer-android",
        "//src/main/java/com/google/crypto/tink/subtle:hex-android",
    ],
)

android_library(
    name = "shared_pref_keyset_reader",
    srcs = ["SharedPrefKeysetReader.java"],
    deps = [
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:keyset_reader-android",
        "//src/main/java/com/google/crypto/tink/subtle:hex-android",
        "@maven//:com_google_protobuf_protobuf_javalite",
    ],
)

android_library(
    name = "android_keyset_manager",
    srcs = ["AndroidKeysetManager.java"],
    deps = [
        ":android_keystore_kms_client",
        ":shared_pref_keyset_writer",
        "//proto:tink_java_proto_lite",
        "//src/main/java/com/google/crypto/tink:aead-android",
        "//src/main/java/com/google/crypto/tink:binary_keyset_reader-android",
        "//src/main/java/com/google/crypto/tink:cleartext_keyset_handle-android",
        "//src/main/java/com/google/crypto/tink:key_template-android",
        "//src/main/java/com/google/crypto/tink:keyset_writer-android",
        "//src/main/java/com/google/crypto/tink:registry_cluster-android",
        "//src/main/java/com/google/crypto/tink:tink_proto_parameters_format-android",
        "//src/main/java/com/google/crypto/tink/subtle:hex-android",
        "@maven//:androidx_annotation_annotation",
        "@maven//:com_google_code_findbugs_jsr305",
        "@maven//:com_google_errorprone_error_prone_annotations",
    ],
)
